<template>
  <div class="container">
    <dl class="list" v-for="(item, index) in jsData" :key="index">
      <dt class="list-title">{{ item.title }}</dt>
      <dd class="list-item" v-for="(subItem, subIndex) in item.list" :key="subIndex" @click="navToDesc(subItem.url)">
        <img class="item-avatar" :src="subItem.avatar" alt="">
        <p class="item-title">
          <span class="item-name">{{ subItem.title }}</span>
          <span class="item-time">{{ subItem.time }}</span>
        </p>
        <p class="item-desc">{{ subItem.desc }}</p>
      </dd>
    </dl>
  </div>
</template>

<script>
import data from '@/assets/data.json';

export default {
  mpType: 'page',

  data(){
    return {
      jsData: data.javascript
    }
  },

  methods: {
    navToDesc(url){
      this.$router.push(url);
    }
  }
}
</script>

<style lang="scss" scoped>
.list-title{
  padding: 0 15px;
  font-size: 14px;
  color: #353535;
  height: 49px;
  line-height: 49px;
  border-bottom: 1px solid #e9e9e9;
  &::before{
    margin-right: 11px;
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: $themeColor;
    border-radius: 50%;
    vertical-align: middle;
  }
}
.list-item{
  padding: 10px 15px;
  padding-left: 70px;
  border-bottom: 1px solid #e9e9e9;
  overflow: hidden;
}
.list-item .item-avatar{
  float: left;
  margin-left: -55px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
}
.list-item .item-title{
  display: flex;
  justify-content: space-between;
  line-height: 24px;
}
.list-item .item-title .item-name{
  color: #808c8c;
  font-size: 14px;
  
}
.list-item .item-title .item-time{
  color: #8e9396;
  font-size: 8px;
}
.list-item .item-desc{
  margin-top: 2px;
  font-size: 12px;
  line-height: 18px;
  color: #aaaaaa;
}
</style>
